﻿using System.Collections.Generic;

namespace ElectronicCommerce.Framework.Web.Mvc
{
    public class MetadataScripts : List<MetadataScriptLink>
    {
        public void Add(string url)
        {
            Add(url, false);
        }

        public void Add(string url, bool inHtmlHead)
        {
            this.Add(Get(url, inHtmlHead));
        }

        public void Insert(string url, bool inHtmlHead)
        {
            this.Insert(0, Get(url, inHtmlHead));
        }

        public MetadataScriptLink Get(string url, bool inHtmlHead)
        {
            return new MetadataScriptLink()
            {
                Type = "text/javascript",
                Src = url,
                InHtmlHead = inHtmlHead,
            };
        }
    }
}
